package com.paranoidmonkey.ode;

import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;

public class HeightfieldData{
	protected long handle;
	
	public HeightfieldData(){
		handle=AndrODE.dGeomHeightfieldDataCreate();
	}
	protected HeightfieldData(long id){
		handle=id;
	}

	public void destroy(){
		AndrODE.dGeomHeightfieldDataDestroy(handle);
	}

	// public final static native void dGeomHeightfieldDataBuildCallback( long
	// d,
	// Buffer pUserData, dHeightfieldGetHeight[] pCallback,
	// float width, float depth, int widthSamples, int depthSamples,
	// float scale, float offset, float thickness, int bWrap );

	public void buildByte(byte[] pHeightData, float width, float depth,
			int widthSamples, int depthSamples, float scale, float offset,
			float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildByte(handle, pHeightData, width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildShort(short[] pHeightData, float width, float depth,
			int widthSamples, int depthSamples, float scale, float offset,
			float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildShort(handle, pHeightData, width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildSingle(float[] pHeightData, float width, float depth,
			int widthSamples, int depthSamples, float scale, float offset,
			float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildSingle(handle, pHeightData, width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildDouble(double[] pHeightData, float width,
			float depth, int widthSamples, int depthSamples, float scale,
			float offset, float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildDouble(handle, pHeightData, width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildByte(ByteBuffer pHeightData, boolean copy, float width, float depth,
			int widthSamples, int depthSamples, float scale, float offset,
			float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildByte(handle, pHeightData, (copy)?(1):(0), width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildShort(ShortBuffer pHeightData, boolean copy, float width, float depth,
			int widthSamples, int depthSamples, float scale, float offset,
			float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildShort(handle, pHeightData, (copy)?(1):(0), width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildSingle(FloatBuffer pHeightData, boolean copy, float width, float depth,
			int widthSamples, int depthSamples, float scale, float offset,
			float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildSingle(handle, pHeightData, (copy)?(1):(0), width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void buildDouble(DoubleBuffer pHeightData, boolean copy, float width,
			float depth, int widthSamples, int depthSamples, float scale,
			float offset, float thickness, int bWrap){
		AndrODE.dGeomHeightfieldDataBuildDouble(handle, pHeightData, (copy)?(1):(0), width, depth, widthSamples, depthSamples, scale, offset, thickness, bWrap);
	}

	public void setBounds(float minHeight, float maxHeight){
		AndrODE.dGeomHeightfieldDataSetBounds(handle, minHeight, maxHeight);
	}

}
